package com.spgf.controller.fragments;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.archtecture.model.exceptions.NegocioException;
import com.archtecture.model.patterns.PadraoFragmentCad;
import com.spgf.controller.R;
import com.spgf.model.dao.ExportarData;
import com.spgf.model.rn.LancamentoRN;
import com.spgf.model.utils.AndroidUtil;

public class FerramentasActivity extends PadraoFragmentCad {

	@Override
	public void onClick(View pView) {

//		if (pView.getId() == R.id.btn_ferramentas_importar_lancamentos_vale_refeicao) {
//
//			try {
//				new LancamentoRN(this.getActivity()).importarLancamento();
//				Toast.makeText(this.getActivity(), "Despesas importadas com sucesso.", Toast.LENGTH_LONG).show();
//			} catch (NegocioException e) {
//				Toast.makeText(this.getActivity(), AndroidUtil.obterMensagemErro(e), Toast.LENGTH_LONG).show();
//			}
//		}

		if (pView.getId() == R.id.btn_ferramentas_importar_lancamentos_vale_refeicao) {

			try {
				new ExportarData().exportar(this.getActivity());
			} catch (NegocioException e) {
				Toast.makeText(this.getActivity(), AndroidUtil.obterMensagemErro(e), Toast.LENGTH_LONG).show();
			}
		}
	}

	@Override
	public void configurarTela(LayoutInflater inflater, ViewGroup container) throws NegocioException {

		rootView = inflater.inflate(R.layout.activity_ferramentas, container, false);

		rootView.findViewById(R.id.btn_ferramentas_importar_lancamentos_vale_refeicao).setOnClickListener(this);

	}
}
